package controladores;

import java.util.Collection;
import java.util.Map;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.api.SubstanceSkin;
import org.jvnet.substance.skin.*;
import vistas.VistaPrincipal;

/**
 * @author Shidobu
 */
public class ControladorPrincipal {
	private VistaPrincipal vista;
	public String nom_usu;

	public ControladorPrincipal () {
	}

	public void reiniciar () {
		vista.dispose ();
                vista = null;
		iniciar ();
	}

	public void salir () {
		vista.dispose ();
		vista = null;
                System.exit(0);
	}

	public void iniciar () {
		vista = new VistaPrincipal (this);
		vista.setVisible (true);
                vista.setIconImage(new ImageIcon(getClass().getResource("/imagenes/iconoReusa.png")).getImage());//icono de la aplicacion
	}

	/**
	 * @param args the command line arguments
	 */
	public static void main (String[] args) {
//		JFrame.setDefaultLookAndFeelDecorated (true);
//		JDialog.setDefaultLookAndFeelDecorated (true);

		SwingUtilities.invokeLater (new Runnable () {
			public void run () {
				try {
                                        UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceMistAquaLookAndFeel");
                                        //UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader());
                                        //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                                        //UIManager.setLookAndFeel(new SubstanceBusinessLookAndFeel());
                                        UIManager.setLookAndFeel(new SubstanceSaharaLookAndFeel());


					ControladorPrincipal controlador = new ControladorPrincipal ();
					controlador.iniciar ();
				}
				catch (Exception e) {
					System.out.println ("No se cargo look and feel");
                                        e.printStackTrace();
				}
			}

		});//Fin invokelater
	}

}
